package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;

@TableName("t_user")
public class UserBean {
    @TableId(value = "pk_userId",type = IdType.AUTO)
    private Integer id;
    @Pattern(regexp = "[a-zA-Z\\u4e00-\\u9fa5]{2,}",message = "用户名只能是两位以上的汉子或字母")
    @TableField("u_username")
    private String username;
    @NotBlank(message = "性别不能为空")
    @TableField("u_gender")
    private String gender;
    @NotNull(message = "工资不能为空")
    @TableField("u_salary")
    private Integer salary;
    @NotNull(message = "生日不能为空")
    @TableField("u_birthday")
    private LocalDate birthday;

    public UserBean() {
    }

    public UserBean(String username, String gender, Integer salary, LocalDate birthday) {
        this.username = username;
        this.gender = gender;
        this.salary = salary;
        this.birthday = birthday;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", gender='" + gender + '\'' +
                ", salary=" + salary +
                ", birthday=" + birthday +
                "}\n";
    }
}
